package br.gov.ce.fortaleza.cti.web.bean;

public class CrudStateBean extends BaseStateBean {

	public static final String SAVEMONTARROTA = "SAVEMONTARROTA";

	public static final String SAVE_GENERIC_ROTA = "SAVE_GENERIC_ROTA";

	public static final String SAVE_IMPORT_AREA = "SAVE_IMPORT_AREA";

	public static final String SAVE_IMPORT_PONTO = "SAVE_IMPORT_PONTO";

	public static final String SEARCHTRANSMISSAO = "SEARCHTRANSMISSAO";

	public static final String SAVE = "SAVE";

	public static final String SEARCH = "SEARCH";

	public static final String UPDATE = "UPDATE";

	public static final String DELETE = "DELETE";

	public static final String VIEW = "VIEW";

    public boolean isSearchState() {

    	return SEARCH.equals(getCurrentState());
    }

    public boolean isSearchTransmissaoState() {

    	return SEARCHTRANSMISSAO.equals(getCurrentState());
    }

    public boolean isSaveState() {

    	return SAVE.equals(getCurrentState());
    }

    public boolean isSaveMontarRotaState() {

    	return SAVEMONTARROTA.equals(getCurrentState());
    }
    
    public boolean isSaveGenericRotaState() {

    	return SAVE_GENERIC_ROTA.equals(getCurrentState());
    }
    
    public boolean isSaveImportarAreaState() {

    	return SAVE_IMPORT_AREA.equals(getCurrentState());
    }
    
    public boolean isSaveImportarPontoState() {

    	return SAVE_IMPORT_PONTO.equals(getCurrentState());
    }

    public boolean isUpdateState() {

    	return UPDATE.equals(getCurrentState());
    }

    public boolean isDeleteState() {

    	return DELETE.equals(getCurrentState());
    }

    public boolean isViewState() {

    	return VIEW.equals(getCurrentState());
    }

	public String prepareSave() {

		setCurrentBean(currentBeanName());

		setCurrentState(SAVE);

		return SUCCESS;
    }

	public String prepareSaveMontarRota() {

		setCurrentBean(currentBeanName());

		setCurrentState(SAVEMONTARROTA);

		return SUCCESS;
    }
	
	public String prepareSaveGenericRota() {

		setCurrentBean(currentBeanName());

		setCurrentState(SAVE_GENERIC_ROTA);

		return SUCCESS;
    }
	
	public String prepareSaveImportarArea() {

		setCurrentBean(currentBeanName());

		setCurrentState(SAVE_IMPORT_AREA);

		return SUCCESS;
    }
	
	public String prepareSaveImportarPonto() {

		setCurrentBean(currentBeanName());

		setCurrentState(SAVE_IMPORT_PONTO);

		return SUCCESS;
    }

	public String prepareUpdate() {

		setCurrentBean(currentBeanName());

		setCurrentState(UPDATE);

		return SUCCESS;
    }

	public String prepareDelete() {

		setCurrentBean(currentBeanName());

		setCurrentState(DELETE);

		return SUCCESS;
    }

    public String save() {

    	setCurrentBean(currentBeanName());

    	return search();
    }

    public String update() {

    	setCurrentBean(currentBeanName());

    	return search();
    }

    public String delete() {

    	setCurrentBean(currentBeanName());

    	return search();
    }

    public String search() {

    	setCurrentBean(currentBeanName());

    	setCurrentState(SEARCH);

    	return SUCCESS;
    }

    public String searchTransmissao() {

    	setCurrentBean(currentBeanName());

    	setCurrentState(SEARCHTRANSMISSAO);

    	return SUCCESS;
    }

}